package OperationSystem.day1203blocking_queue_阻塞队列;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;

public class JDK_Provide_Blocking_Queue {//jdk中提供的原生阻塞队列

    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> q;

        q = new ArrayBlockingQueue<>(16);  //有容量上限
        q = new LinkedBlockingQueue<>();            //没有容量上限
        q = new PriorityBlockingQueue<>();          //优先级阻塞队列

        q.put("str");
        String message = q.take();
        System.out.println(message);
    }
}
